<!DOCTYPE html>
<html>

<head>
    <meta name="viewport"
        content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <script type="text/javascript" src="flexible.min.js">
    </script>
    <style>
        /* * {
            margin: 0;
            padding: 0;
        } */

        html,
        body {
            height: 100%;
        }

        /* 
        .table table {
            font-size: 14px;
            line-height: 32px;
            margin: 0 auto;
            vertical-align: middle;
        } */

        /* table {
            border: solid 1px #a59e9e;
        } */

        table td {
            text-align: center;
        }

        span {
            /* font-weight: bold; */
            /* padding-left: 10px; */
            font-size: 18px;
            text-align: center;
        }

        .data {
            /* font-size: 16px; */
            height: 30px;
        }
    </style>
</head>

<body style=" margin:0px;">


    <table id="t" style="width:100%; " border="1" cellspacing="0">
        <tr style="height: 35px;">
            <td><span>车型</span></td>
            <td><span>交付时间</span></td>
            <td><span>数量</span></td>
            <td><span>发动机排量</span></td>
            <td><span>变速箱</span></td>
            <td><span>轮胎</span></td>
            <td><span>中控</span></td>
            <td><span>刹车</span></td>
            <td><span>悬挂</span></td>
        </tr>
        <tbody id="mainbody">

        </tbody>

    </table>

    <script>
        function addingData(dataArray) {
            var table = document.getElementById("mainbody");
            // Reset First
            table.innerHTML = "";
            for (let index = 0; index < dataArray.length; index++) {
                const element = dataArray[index];

                var row = table.insertRow(table.rows.length);
                row.className = "data"
                var cell1 = row.insertCell(0);
                var cell2 = row.insertCell(1);
                var cell3 = row.insertCell(2);
                var cell4 = row.insertCell(3);
                var cell5 = row.insertCell(4);
                var cell6 = row.insertCell(5);
                var cell7 = row.insertCell(6);
                var cell8 = row.insertCell(7);
                var cell9 = row.insertCell(8);
                cell1.innerHTML = element["carId"];
                cell2.innerHTML = getData(parseInt(element["time"]));
                cell3.innerHTML = element["num"];
                cell4.innerHTML = element["engine"];
                cell5.innerHTML = element["speed"] == 0 ? "自动" : "手动";
                cell6.innerHTML = element["wheel"] == 0 ? "烤漆" : "电镀";
                cell7.innerHTML = element["control"] == 0 ? "低配" : "高配";
                cell8.innerHTML = element["brake"] == 0 ? "故事制动器" : "盘式制动器";
                cell9.innerHTML = hangSwitch(parseInt(element["hang"]));

            }

            function hangSwitch(d) {
                switch (d) {
                    case 1:
                        return "X";
                        break;
                    case 2:
                        return "J";
                        break;
                    case 3:
                        return "Z";
                        break;
                    case 4:
                        return "A";
                        break;
                    case 5:
                        return "E";
                        break;
                    case 6:
                        return "XH";
                        break;
                    case 7:
                        return "F";
                        break;

                    default:
                        break;
                }
            }

            function getData(t) {
                var date = new Date(t * 1000);
                return date.getFullYear() + '-' + date.getMonth() + " " + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes();
            }
        }
    </script>
</body>

</html>